# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Gabriel-Andrew Pollo-Guilbert <gabrielpolloguilbert@gmail.com>

_hkgname=parsec-numbers
pkgname=haskell-${_hkgname}
pkgver=0.1.0
pkgrel=18
pkgdesc='Number parsers without the need to use a large (and unportable) token parser'
url='https://hackage.haskell.org/package/parsec-numbers'
arch=('loong64' 'x86_64')
license=('BSD')
depends=('ghc-libs' 'haskell-parsec')
makedepends=('ghc')
source=(https://hackage.haskell.org/package/${_hkgname}-${pkgver}/${_hkgname}-${pkgver}.tar.gz)
sha512sums=('8a06ef239e6fb9fabaf04d947c21b298acd9538d2f98dd2404d943c18b5f29aa0d11572be3e1a846ae3d1345fbbdc5b2803df3ec196ccc212c4d76082c930b05')

build() {
  cd ${_hkgname}-${pkgver}
  runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
      --prefix=/usr --docdir=/usr/share/doc/$pkgname \
      --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --ghc-option=-fllvm
  runhaskell Setup build $MAKEFLAGS
  runhaskell Setup register --gen-script
  runhaskell Setup unregister --gen-script
  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
}

package() {
  cd ${_hkgname}-${pkgver}
  install -Dm 744 register.sh "${pkgdir}/usr/share/haskell/register/${pkgname}.sh"
  install -Dm 744 unregister.sh "${pkgdir}/usr/share/haskell/unregister/${pkgname}.sh"
  runhaskell Setup copy --destdir="$pkgdir"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
